--- title: "69. Sqrt(x)" created: 2025-12-22 --- # 69. Sqrt(x) ## 题目 [**69. Sqrt(x)**](https://leetcode.com/problems/sqrtx/) ![[image-85e2e79c.png]] ## 思路分析 ![[image-dff06c09.png]] ## 代码实现 ```java class Solution { public int mySqrt(int x) { if (x < 2) return x; int l=1,r=x/2; while(l>>1; if ((long)mid*mid <= x) { l=mid; } else { r = mid - 1; } } return r; } } ``` ## 同类题型 ## 视频讲解